    <template>
<van-form @submit="handleSubmit" :model="form">
      <van-field v-model="form.name" label="Name" required></van-field>
      <van-field v-model="form.age" label="Age" type="number" required></van-field>
      <van-button type="primary" native-type="submit">Submit</van-button>
    </van-form>
  </template>
  <script>
  import { reactive } from 'vue';
  import axios from 'axios';
  import service from '@/utils/request';

  export default {
    setup() {
      const form = reactive({
        name: '',
        age: null,
      });
  
      const handleSubmit = async () => {
        try {
            console.log(form);
             // 遍历form对象
  for (let key in form) {
    console.log(key + ": " + form[key]);
  }

      const response = await service.post('/api/accessControl/testIt', form, {
            // headers: {
            //   'Content-Type': 'application/json'
            // }
          });
          console.log(response.data);
          // Handle response here
        } catch (error) {
          console.error(error);
          // Handle error here
        }
      };
  
      return {
        form,
        handleSubmit,
      };
    },
  };
  </script>